#! /bin/zsh

echo "$1"

if [ "$1" = "online" ]; then
    sshpass -p 'jXj2PGr:yhnN4XM' scp -r ./dist/* root@114.132.165.177:/opt/apps/wujue_cs_frontend/
    # 设置权限
    sshpass -p 'jXj2PGr:yhnN4XM' ssh root@114.132.165.177 "cd /opt/apps/wujue_cs_frontend && find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 644 {} \;"
elif [ "$1" = "test" ]; then
    sshpass -p 'jXj2PGr:yhnN4XM' scp -r ./test/* root@114.132.165.177:/opt/apps/wujue_cs_frontend_test/
    # 设置权限：文件夹 755，文件 644
    sshpass -p 'jXj2PGr:yhnN4XM' ssh root@114.132.165.177 "cd /opt/apps/wujue_cs_frontend_test && find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 644 {} \;"
    echo "文件上传完成，权限已自动设置"
fi